﻿@{
    ViewBag.Title = "TemplateType";
    Layout = "~/Views/Shared/_adminLayout.cshtml";
}

@model Pagination<Wx_TemplateImageType>

<h2 class="sub-header">背景图片分类</h2>
<hr />
@using (Html.BeginForm("TemplateTypeCreate", "Qrcode", FormMethod.Post, new { id = "form1", Class = "from", onsubmit = "return checkInput();", enctype = "multipart/form-data" }))
{

    <input type="text" class="form-control" name="TypeName" id="TypeName" style="width:200px;display:inline-block" data-rule-required='true' data-msg-required="请输入名字" placeholder="类型">
    <input type="hidden" name="TypeId" id="TypeId">
    <button type="submit" id="btnEdit" class="btn btn-default">添加</button>
}
<hr />
<div class="table-responsive">
    <table class="table table-striped table-bordered table-hover table-condensed">
        <thead>
            <tr>        
                <th>标题</th>
                <th>排序</th>               
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @item.TypeName
                    </td>                
                    <td>@item.Sort</td>
                    <td>                        
                        @using (Html.BeginForm("TemplateTypeDelete", "Qrcode", new { id = @item.TypeId }, FormMethod.Post, new { onsubmit = "return marksure();", style = "display:inline-block" }))
                        {
                            <input type="submit" class="btn btn-default" value="Delete" />
                        }
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
<nav>
    <ul class="pagination">
        <li>
            @Html.ActionLink("<<", "TemplateType", new { page = 0 })
        </li>
        @for (int i = 0; i < Model.TotalPages; i++)
        {
            if (i == Model.PageIndex)
            {
                <li class="active">
                    @Html.ActionLink((i + 1).ToString(), "TemplateType", new { page = i })
                </li>
            }
            else
            {
                <li>
                    @Html.ActionLink((i + 1).ToString(), "TemplateType", new { page = i })
                </li>
            }
        }
        <li>
            @Html.ActionLink(">>", "TemplateType", new { page = Model.TotalPages - 1 > 0 ? Model.TotalPages - 1 : 0 })
        </li>
    </ul>
</nav>

